package com.example.littleSpider.myapplication.fragment;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.littleSpider.myapplication.R;
import com.example.littleSpider.myapplication.adapter.VideoListAdapter;
import com.example.littleSpider.myapplication.base.BaseFragment;
import com.example.littleSpider.myapplication.bean.MyBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import es.dmoral.toasty.Toasty;

/**
 * 小视频的最热模块
 * Created by aduser on 2017/12/7.
 */

public class FragmentHotVideo extends BaseFragment {

    @BindView(R.id.recycler_view)
    RecyclerView mRecyclerView;

    @Override
    protected int setLayout() {
        return R.layout.fragment_video_page;
    }

    @Override
    protected void initView() {
        GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
        List<String> stringList = new ArrayList<>();
        for (int i = 0; i < 20; i++){
            MyBean bean = new MyBean();
            bean.setAge(1);
            stringList.add("position:" + i);
        }
        VideoListAdapter myAdapter = new VideoListAdapter(R.layout.include_things_view, stringList);
        mRecyclerView.setAdapter(myAdapter);
        mRecyclerView.setLayoutManager(layoutManager);
        myAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                Toasty.error(getContext(), "你在点击第" + position + "条").show();
            }
        });
    }

    @Override
    protected void initData() {

    }
}
